﻿using Internal.Runtime.Models;
using Runtime.Services.BattleSkill;

namespace Runtime.Models {

    /// <summary>
    /// 单元格数据
    /// </summary>
    public partial interface IDFR_BattleCellModelTD : IDFR_BattleCellModelBase {

        new IDFR_BattleCellModelTDSetter AsSetter();

        IDFR_BattleEffectTarget AsSkillTarget();

        /// <summary>
        /// 是否是道路
        /// </summary>
        bool IsRoad { get; }
    }

    public partial interface IDFR_BattleCellModelTDSetter : IDFR_BattleCellModelBaseSetter, IDFR_BattleCellModelTD {
    }

    public abstract partial class DFR_BattleCellModelTD : DFR_BattleCellModelBase, IDFR_BattleCellModelTD, IDFR_BattleCellModelTDSetter, IDFR_BattleCellModelTDInternal, IDFR_BattleEffectTarget {

        public new IDFR_BattleCellModelTDSetter AsSetter() => this;

        public IDFR_BattleEffectTarget AsSkillTarget() => this;

        public bool IsRoad => !IsOperatable;

        bool IDFR_BattleEffectTarget.IsEnabled => base.IsEnabled;

        protected partial void AttachBuff();

        protected partial void DetachBuff();

        private partial void DisposeBuffProvider();
        protected override void Dispose() {
            DisposeBuffProvider();
            base.Dispose();
        }

        private partial bool InitializeBuffProvider();
        protected override bool Initialize() {
            if (!InitializeBuffProvider()) {
                return false;
            }
            return true;
        }

        protected override void Summon() {
            AttachBuff();
        }

        protected override void Dismiss() {
            DetachBuff();
        }
    }
}

namespace Internal.Runtime.Models {

    public interface IDFR_BattleCellModelTDInternal : IDFR_BattleCellModelBaseInternal {
    }
}